/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ni;

import java.io.*;
import java.net.*;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
 *
 * @author Marianne Bellanger
 */
public class ServerSock implements Runnable {

    ServerSocket servsock;
    private Socket socketretour;
    private ClassTCP containeur;

    public Socket getSocketretour() {
        return socketretour;
    }

    public ServerSock (int port) throws IOException {
        try {
            servsock = new ServerSocket(port);
	}
	catch (IOException exp) {
            System.out.println("Probleme ouverture server socket");
	}
}

    public void run() {
        while(true){
            try {
                socketretour = servsock.accept();
                containeur.getSockretour(socketretour);
            } catch (IOException ex) {
                Logger.getLogger(ServerSock.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

    }
}
